package com.openbravo.pos.panels.link.model;

import cn.ekuma.data.ui.swing.AbstractDTOTableModel;

import com.openbravo.bean.crm.viewbean.ProductCustomerView;
import com.openbravo.bean.infobean.CustomerInfo;
import com.openbravo.format.Formats;
import com.openbravo.pos.base.AppLocal;

public class ProductCustomerViewTableModel extends AbstractDTOTableModel<ProductCustomerView> {

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		ProductCustomerView view=this.getObj(rowIndex);
		CustomerInfo customerInfo=view.getCustomerInfo();
		switch(columnIndex){
		case 0:
			return customerInfo.getTaxid();
		case 1:
			return customerInfo.getSearchkey();
		case 2:
			return customerInfo.getName();
		case 3:
			return Formats.CURRENCY.formatValue(view.getPriceIn());
		case 4:
			return Formats.TIMESTAMP.formatValue(view.getTimeIn());
		case 5:
			return view.getReasonIn();
		case 6:
			return Formats.CURRENCY.formatValue(view.getPriceOut());
		case 7:
			return Formats.TIMESTAMP.formatValue(view.getTimeOut());
		case 8:
			return view.getReasonOut();
		}
		return null;
	}

	@Override
	public String[] getColumnNames() {
		return new String[]{
				AppLocal.getIntString("label.taxid"),
				AppLocal.getIntString("label.searchkey"),
				AppLocal.getIntString("label.name"),
				AppLocal.getIntString("label.CustomerProduct.priceIn"),
				AppLocal.getIntString("label.CustomerProduct.timeIn"),
				AppLocal.getIntString("label.CustomerProduct.reasonIn"),
				AppLocal.getIntString("label.CustomerProduct.priceOut"),
				AppLocal.getIntString("label.CustomerProduct.timeOut"),
				AppLocal.getIntString("label.CustomerProduct.reasonOut")
	          };
	}
}
